import "./index.scss";


function getParams(key) {
    let search = location.search;
    let arr = search.slice(1).split("&");
    let obj = {};
    for (let i = 0; i < arr.length; i++) {
        let item = arr[i];
        let childArr = item.split("=");
        obj[childArr[0]] = childArr[1];
    }
    return obj[key];
}

function init() {
    let id = getParams("id");
    $.ajax({
        url: "/c/News/getNewsById",
        type: "POST",
        data: {
            id
        },
        success: function (res) {
            $(".title").html(res.title);
            $(".time").html(res.pubTime);
            $(".article").html(res.content);
        }
    });
}
init();